<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        .box {
            position: relative;
            width: 300px;
            height: 600px;
            margin: 0 auto;
            border: 1px solid red;
            perspective: 1000px;
        }
        .box>div {
            position: absolute;
            top: 0;
            left: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            font-weight: bold;
            transition: all 2s;
            backface-visibility: hidden;
            transform-style: preserve-3d;
        }
        .front {
            width: 300px;
            height: 100%;
            background-color: rgb(81, 88, 182);
            font-size: 40px;
            text-align: center;
        }
        
        .back {
            width: 300px;
            height: 100%;
            background-color: pink;
            font-size: 40px;
            text-align: center;
            transform: rotateY(180deg);
        }
        .box:hover .back {
            transform: rotateY(0deg);
        }
        .box:hover .front {
            transform: rotateY(-180deg);
        }
        .box:hover .text {
            transform: translate3d(0,0,20px);
            /* transform: translateZ(20px); */
        }

    </style>
</head>
<body>
    <div class="box">
        <div class="front">
            <div class="text">正面</div>
        </div>
        <div class="back">
            <div class="text">反面</div>
        </div>
    </div>

</body>
</html>